import Vue from 'vue'
import App from './App.vue'
import router from './router'
// import './plugins/element.js'

import BaiduMap from 'vue-baidu-map'
import * as echarts from "echarts";

import Axios from 'axios'
//字体图标文件
import font from './assets/fonts/iconfont.css'

//全局css样式
import css from './assets/css/globle.css'

// 面包屑导航和卡片视图
import template from './components/template.vue'
import ElementUI from 'element-ui'
// import { Message } from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import TreeTable from 'vue-table-with-tree-grid'
// 导入富文本编辑器
import VueQuillEditor from 'vue-quill-editor'
// 导入富文本编辑器对应的样式
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
import './mock/index.js'
import store from './components/store'
//配置请求的根路径
// Axios.defaults.baseURL = 'http://localhost:10081/manage/'

// axios请求拦截器添加token，保证拥有获取数据的权限
Axios.interceptors.request.use(config => {
    //为请求头对象,添加Token验证的Authorization字段
    config.headers.Authorization = window.sessionStorage.getItem("token")
    return config
})

Vue.component("layout-box", template)

Vue.component("tree-table", TreeTable)

// 过滤器
Vue.filter("formatDate", function (time) {
    const date = new Date(time)
    var y = date.getFullYear()
    var m = (date.getMonth() + 1 + '').padStart(2, '0')
    var d = (date.getDate() + '').padStart(2, '0')
    var hh = (date.getHours() + '').padStart(2, '0')
    var mm = (date.getMinutes() + '').padStart(2, '0')
    var ss = (date.getSeconds() + '').padStart(2, '0')
    return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
})
Vue.use(ElementUI)
Vue.use(BaiduMap, {
    // ak 是在百度地图开发者平台申请的密钥 详见 http://lbsyun.baidu.com/apiconsole/key */
    ak: 'OOHPbl5oLyqViwx5xmge4FrKjsOCiMku'
})
Vue.use(echarts)
// 将富文本编辑器注册为全局组件
Vue.use(VueQuillEditor)

// 把axios引入到vue中
Vue.prototype.$http = Axios
Vue.config.productionTip = false
// 挂载到$message上
// Vue.prototype.$message = Message
new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app')